1 {\rtf1\mac\ansicpg10000\cocoartf102
2 {\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique;
4 {\colortbl;\red255\green255\blue255;}
5 \paperw11905\paperh16837\margl1440\margr1440\vieww11440\viewh9560\viewkind0
6 \pard\tx565\tx1133\tx1700\tx2266\tx2833\tx3401\tx3967\tx4535\tx5102\tx5669\tx6235\tx6802\ql\qnatural
8 \f0\b\fs24 \cf0 How to make an Adium plugin localizable, for developers
12 \f0\b 1. Strings in code
15 In order to make the code localizable, you need to replace hardcoded strings with the following macro:\
17 AILocalizedString(theString,theComment)\
21 \f1\i0 with the original string, so for example:\
23 NSString *theExampleString = @"this is an example";\
27 NSString *theExampleString = AILocalizedString(@"this is an example", "this is a comment");\
29 You can leave the comment out by putting
31 \f1\i0 , it is not really needed. But it will show in the localization files that eventually will end in translators hands, so adding a bit of context for the string is a plus.\
33 The macro works this way: if looks for the current language resources folder, and load the
34 \f2\i Localizable.strings
35 \f1\i0 file from there and look for the key string (the string in English) and then use the left value of the dict (the file is actually a key-value pair dictionary). If there is no file, it just uses the key value, so it is safe to use the macro even if you have not set up a localization folder scheme. It also allows the use of the CLI utility
37 \f1\i0 to scan the source file and generates the initial Localizable.strings file for you.\
40 \f0\b 2. Make a Localizable.strings file
43 Once you have all your hardcoded strings done with the macro, read above, you can generate the proper strings file and include it in the project file. Open up Terminal.app, type "cd " (that last thing is a space) and drop your plugin folder on top of the Terminal window. Hit enter, and then type this:\
45 genstrings -a -s AILocalizedString AIYourPlugin.m\
47 And hit enter, replacing
49 \f1\i0 with your source code file name, and repeating the command if you have several source code files with AILocalizedString strings. That will generate a
50 \f2\i Localizable.strings
51 \f1\i0 file in your plugin directory, you should take a look at it in case some strings got duplicated, which can be the case, and you can delete them.\
53 Time to add the file to the project. Add it, and remember to assign it to the plugin target, and not adium itself. Once it is added, select it in the file browser and select
57 \f1\i0 menu. And in the inspector pane that appear, click on the
58 \f2\i Make Localizable
59 \f1\i0 button. That will make a new folder in your plugin's folder (named English.lproj) and move the
60 \f2\i Localizable.strings
61 \f1\i0 file inside that folder.\
64 \f0\b 3. Make localizable nibs
67 The last step to make your plugin localizable is to set up the nibs. All you have to do is select the nib in the file browser of Xcode, select
71 \f1\i0 menu and hit the
72 \f2\i Make Localizable
73 \f1\i0 button that appear in the inspector pane. That will move the nib to the English.lproj folder made in the previous step.\
75 And that's all. If you add new strings in the code you may need to repeat step 2. Look forward for another tutorial on how to actually translate the plugins.}